package com.jvm.gc;

/**
 * @Author RJA
 * @Date 2020/4/7 14:39
 * @Description
 */
public class MyTest4 {

    public static void main(String[] args) throws InterruptedException {
        byte[] byte_1 = new byte[512 * 1024];
        byte[] byte_2 = new byte[512 * 1024];

        myGc();
        Thread.sleep(1000);

        System.out.println("==============");

        myGc();
        Thread.sleep(1000);

        System.out.println("--------------");

        myGc();
        Thread.sleep(1000);

        System.out.println("aaaaaaaaaaaaaa");

        myGc();
        Thread.sleep(1000);

        System.out.println("bbbbbbbbbbbbb");

        byte[] byte_3 = new byte[1024 * 1024];
        byte[] byte_4 = new byte[1024 * 1024];
        byte[] byte_5 = new byte[1024 * 1024];

        myGc();
        Thread.sleep(1000);

        System.out.println("ccccccccccccc");

        myGc();
        Thread.sleep(1000);

        System.out.println("ddddddddddddd");

        System.out.println("hello world");
    }

    private static void myGc(){
        for (int i = 0; i < 40; ++i){
            byte[] byteArray = new byte[1024 * 1024];
        }
    }
}
